#include "db_proto.h"
#include "jmsg.h"
static const unsigned char s_protoString []= {
   0x44,0x42,0x4d,0x73,0x67,0x41,0x64,0x64,0x52,0x65,
   0x67,0x69,0x73,0x74,0x65,0x72,0x50,0x6c,0x61,0x79,
   0x65,0x72,0x52,0x65,0x71,0x75,0x65,0x73,0x74,0x20,
   0x3d,0x20,0x31,0x20,0x7b,0x0a,0x09,0x75,0x73,0x65,
   0x72,0x4e,0x61,0x6d,0x65,0x20,0x3a,0x20,0x73,0x74,
   0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x0a,0x09,
   0x70,0x61,0x73,0x73,0x77,0x6f,0x72,0x64,0x53,0x68,
   0x61,0x31,0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,
   0x67,0x20,0x3d,0x20,0x32,0x0a,0x7d,0x0a,0x0a,0x44,
   0x42,0x4d,0x73,0x67,0x41,0x64,0x64,0x52,0x65,0x67,
   0x69,0x73,0x74,0x65,0x72,0x50,0x6c,0x61,0x79,0x65,
   0x72,0x52,0x65,0x73,0x70,0x6f,0x6e,0x73,0x65,0x20,
   0x3d,0x20,0x32,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
   0x75,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,0x20,0x3a,
   0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,
   0x31,0x0a,0x09,0x69,0x73,0x53,0x75,0x63,0x63,0x65,
   0x73,0x73,0x20,0x3a,0x20,0x62,0x6f,0x6f,0x6c,0x20,
   0x3d,0x20,0x32,0x0a,0x09,0x65,0x72,0x72,0x6f,0x72,
   0x43,0x6f,0x64,0x65,0x20,0x3a,0x20,0x69,0x6e,0x74,
   0x20,0x3d,0x20,0x33,0x0a,0x7d,0x0a,0x0a,0x0a,0x44,
   0x42,0x4d,0x73,0x67,0x50,0x6c,0x61,0x79,0x65,0x72,
   0x49,0x6e,0x66,0x6f,0x52,0x65,0x71,0x75,0x65,0x73,
   0x74,0x20,0x3d,0x20,0x33,0x20,0x7b,0x0a,0x09,0x72,
   0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64,0x20,0x3a,
   0x20,0x69,0x6e,0x74,0x20,0x20,0x3d,0x20,0x31,0x0a,
   0x09,0x75,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,0x20,
   0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,
   0x20,0x32,0x0a,0x09,0x70,0x61,0x73,0x73,0x77,0x6f,
   0x72,0x64,0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,
   0x67,0x20,0x3d,0x20,0x33,0x0a,0x09,0x69,0x73,0x47,
   0x75,0x65,0x73,0x74,0x20,0x3a,0x20,0x62,0x6f,0x6f,
   0x6c,0x20,0x3d,0x20,0x34,0x0a,0x7d,0x0a,0x0a,0x44,
   0x42,0x4d,0x73,0x67,0x50,0x6c,0x61,0x79,0x65,0x72,
   0x49,0x6e,0x66,0x6f,0x52,0x65,0x73,0x70,0x6f,0x6e,
   0x73,0x65,0x20,0x3d,0x20,0x34,0x20,0x7b,0x0a,0x09,
   0x69,0x73,0x53,0x75,0x63,0x63,0x65,0x73,0x73,0x20,
   0x3a,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x3d,0x20,0x31,
   0x0a,0x09,0x75,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,
   0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,
   0x3d,0x20,0x32,0x0a,0x09,0x70,0x6c,0x61,0x79,0x65,
   0x72,0x49,0x6e,0x66,0x6f,0x20,0x3a,0x20,0x44,0x42,
   0x4d,0x53,0x47,0x50,0x6c,0x61,0x79,0x65,0x72,0x49,
   0x6e,0x66,0x6f,0x20,0x3d,0x20,0x35,0x0a,0x7d,0x0a,
   0x0a,0x44,0x42,0x4d,0x73,0x67,0x41,0x63,0x74,0x69,
   0x76,0x61,0x74,0x65,0x50,0x6c,0x61,0x79,0x65,0x72,
   0x52,0x65,0x71,0x75,0x65,0x73,0x74,0x20,0x3d,0x20,
   0x35,0x20,0x7b,0x0a,0x09,0x67,0x75,0x65,0x73,0x74,
   0x55,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,0x20,0x3a,
   0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,
   0x31,0x0a,0x09,0x6e,0x65,0x77,0x55,0x73,0x65,0x72,
   0x4e,0x61,0x6d,0x65,0x20,0x3a,0x20,0x73,0x74,0x72,
   0x69,0x6e,0x67,0x20,0x3d,0x20,0x32,0x0a,0x09,0x6e,
   0x65,0x77,0x50,0x61,0x73,0x73,0x77,0x6f,0x72,0x64,
   0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,
   0x3d,0x20,0x33,0x0a,0x09,0x70,0x68,0x6f,0x6e,0x65,
   0x4e,0x6f,0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,
   0x67,0x20,0x3d,0x20,0x34,0x0a,0x7d,0x0a,0x0a,0x44,
   0x42,0x4d,0x73,0x67,0x41,0x63,0x74,0x69,0x76,0x61,
   0x74,0x65,0x50,0x6c,0x61,0x79,0x65,0x72,0x52,0x65,
   0x73,0x70,0x6f,0x6e,0x73,0x65,0x20,0x3d,0x20,0x37,
   0x20,0x7b,0x0a,0x09,0x69,0x73,0x53,0x75,0x63,0x63,
   0x65,0x73,0x73,0x20,0x3a,0x20,0x62,0x6f,0x6f,0x6c,
   0x20,0x3d,0x20,0x31,0x0a,0x09,0x65,0x72,0x72,0x6f,
   0x72,0x43,0x6f,0x64,0x65,0x20,0x3a,0x20,0x69,0x6e,
   0x74,0x20,0x3d,0x20,0x32,0x0a,0x09,0x67,0x75,0x65,
   0x73,0x74,0x55,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,
   0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,
   0x3d,0x20,0x33,0x0a,0x09,0x6e,0x65,0x77,0x55,0x73,
   0x65,0x72,0x4e,0x61,0x6d,0x65,0x20,0x3a,0x20,0x73,
   0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,0x34,0x0a,
   0x7d,0x0a,0x0a,0x44,0x42,0x4d,0x73,0x67,0x53,0x61,
   0x76,0x65,0x50,0x6c,0x61,0x79,0x65,0x72,0x49,0x6e,
   0x66,0x6f,0x20,0x3d,0x20,0x38,0x20,0x7b,0x0a,0x09,
   0x70,0x6c,0x61,0x79,0x65,0x72,0x49,0x6e,0x66,0x6f,
   0x20,0x3a,0x20,0x44,0x42,0x4d,0x53,0x47,0x50,0x6c,
   0x61,0x79,0x65,0x72,0x49,0x6e,0x66,0x6f,0x20,0x3d,
   0x20,0x31,0x0a,0x7d,0x0a,0x0a,0x44,0x42,0x4d,0x53,
   0x47,0x50,0x6c,0x61,0x79,0x65,0x72,0x49,0x6e,0x66,
   0x6f,0x20,0x3d,0x20,0x38,0x30,0x20,0x7b,0x0a,0x09,
   0x75,0x73,0x65,0x72,0x4e,0x61,0x6d,0x65,0x20,0x3a,
   0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,
   0x31,0x0a,0x09,0x69,0x73,0x47,0x75,0x65,0x73,0x74,
   0x20,0x3a,0x20,0x69,0x6e,0x74,0x20,0x3d,0x20,0x32,
   0x0a,0x09,0x6e,0x69,0x63,0x6b,0x4e,0x61,0x6d,0x65,
   0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,
   0x3d,0x20,0x33,0x0a,0x09,0x6c,0x61,0x73,0x74,0x4c,
   0x6f,0x67,0x69,0x6e,0x54,0x69,0x6d,0x65,0x20,0x3a,
   0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x3d,0x20,
   0x34,0x0a,0x09,0x70,0x68,0x6f,0x6e,0x65,0x4e,0x6f,
   0x20,0x3a,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,
   0x3d,0x20,0x35,0x0a,0x09,0x73,0x63,0x6f,0x72,0x65,
   0x20,0x3a,0x20,0x69,0x6e,0x74,0x20,0x3d,0x20,0x36,
   0x0a,0x7d,0x0a,0x0a,0x00
};

JMsgProto* db_protoCreateProto() { return JMsgProto::createProto((char*)s_protoString); }

DBMSGPlayerInfo::DBMSGPlayerInfo() {
   isGuest = 0;
   score = 0;
}

static bool onDBMSGPlayerInfoDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMSGPlayerInfo* value = (DBMSGPlayerInfo*)args;
   switch(field->m_id) {
   case 1: {
      value->userName = reader->readString(isSuccess);
      break;
   }
   case 2: {
      value->isGuest = reader->readInt(isSuccess);
      break;
   }
   case 3: {
      value->nickName = reader->readString(isSuccess);
      break;
   }
   case 4: {
      value->lastLoginTime = reader->readString(isSuccess);
      break;
   }
   case 5: {
      value->phoneNo = reader->readString(isSuccess);
      break;
   }
   case 6: {
      value->score = reader->readInt(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMSGPlayerInfoEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMSGPlayerInfo* value = (DBMSGPlayerInfo*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeStringField(field, value->userName);
      break;
   }
   case 2: {
      writer->writeIntField(field, value->isGuest);
      break;
   }
   case 3: {
      writer->writeStringField(field, value->nickName);
      break;
   }
   case 4: {
      writer->writeStringField(field, value->lastLoginTime);
      break;
   }
   case 5: {
      writer->writeStringField(field, value->phoneNo);
      break;
   }
   case 6: {
      writer->writeIntField(field, value->score);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMSGPlayerInfo::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(80, writer, onDBMSGPlayerInfoEncode, this);
}
bool DBMSGPlayerInfo::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMSGPlayerInfoDecode, this) == 80;
}
DBMsgActivatePlayerRequest::DBMsgActivatePlayerRequest() {
}

static bool onDBMsgActivatePlayerRequestDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgActivatePlayerRequest* value = (DBMsgActivatePlayerRequest*)args;
   switch(field->m_id) {
   case 1: {
      value->guestUserName = reader->readString(isSuccess);
      break;
   }
   case 2: {
      value->newUserName = reader->readString(isSuccess);
      break;
   }
   case 3: {
      value->newPassword = reader->readString(isSuccess);
      break;
   }
   case 4: {
      value->phoneNo = reader->readString(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgActivatePlayerRequestEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgActivatePlayerRequest* value = (DBMsgActivatePlayerRequest*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeStringField(field, value->guestUserName);
      break;
   }
   case 2: {
      writer->writeStringField(field, value->newUserName);
      break;
   }
   case 3: {
      writer->writeStringField(field, value->newPassword);
      break;
   }
   case 4: {
      writer->writeStringField(field, value->phoneNo);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgActivatePlayerRequest::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(5, writer, onDBMsgActivatePlayerRequestEncode, this);
}
bool DBMsgActivatePlayerRequest::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgActivatePlayerRequestDecode, this) == 5;
}
DBMsgActivatePlayerResponse::DBMsgActivatePlayerResponse() {
   isSuccess = false;
   errorCode = 0;
}

static bool onDBMsgActivatePlayerResponseDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgActivatePlayerResponse* value = (DBMsgActivatePlayerResponse*)args;
   switch(field->m_id) {
   case 1: {
      value->isSuccess = reader->readBool(isSuccess);
      break;
   }
   case 2: {
      value->errorCode = reader->readInt(isSuccess);
      break;
   }
   case 3: {
      value->guestUserName = reader->readString(isSuccess);
      break;
   }
   case 4: {
      value->newUserName = reader->readString(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgActivatePlayerResponseEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgActivatePlayerResponse* value = (DBMsgActivatePlayerResponse*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeBoolField(field, value->isSuccess);
      break;
   }
   case 2: {
      writer->writeIntField(field, value->errorCode);
      break;
   }
   case 3: {
      writer->writeStringField(field, value->guestUserName);
      break;
   }
   case 4: {
      writer->writeStringField(field, value->newUserName);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgActivatePlayerResponse::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(7, writer, onDBMsgActivatePlayerResponseEncode, this);
}
bool DBMsgActivatePlayerResponse::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgActivatePlayerResponseDecode, this) == 7;
}
DBMsgAddRegisterPlayerRequest::DBMsgAddRegisterPlayerRequest() {
}

static bool onDBMsgAddRegisterPlayerRequestDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgAddRegisterPlayerRequest* value = (DBMsgAddRegisterPlayerRequest*)args;
   switch(field->m_id) {
   case 1: {
      value->userName = reader->readString(isSuccess);
      break;
   }
   case 2: {
      value->passwordSha1 = reader->readString(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgAddRegisterPlayerRequestEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgAddRegisterPlayerRequest* value = (DBMsgAddRegisterPlayerRequest*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeStringField(field, value->userName);
      break;
   }
   case 2: {
      writer->writeStringField(field, value->passwordSha1);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgAddRegisterPlayerRequest::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(1, writer, onDBMsgAddRegisterPlayerRequestEncode, this);
}
bool DBMsgAddRegisterPlayerRequest::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgAddRegisterPlayerRequestDecode, this) == 1;
}
DBMsgAddRegisterPlayerResponse::DBMsgAddRegisterPlayerResponse() {
   isSuccess = false;
   errorCode = 0;
}

static bool onDBMsgAddRegisterPlayerResponseDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgAddRegisterPlayerResponse* value = (DBMsgAddRegisterPlayerResponse*)args;
   switch(field->m_id) {
   case 1: {
      value->userName = reader->readString(isSuccess);
      break;
   }
   case 2: {
      value->isSuccess = reader->readBool(isSuccess);
      break;
   }
   case 3: {
      value->errorCode = reader->readInt(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgAddRegisterPlayerResponseEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgAddRegisterPlayerResponse* value = (DBMsgAddRegisterPlayerResponse*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeStringField(field, value->userName);
      break;
   }
   case 2: {
      writer->writeBoolField(field, value->isSuccess);
      break;
   }
   case 3: {
      writer->writeIntField(field, value->errorCode);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgAddRegisterPlayerResponse::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(2, writer, onDBMsgAddRegisterPlayerResponseEncode, this);
}
bool DBMsgAddRegisterPlayerResponse::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgAddRegisterPlayerResponseDecode, this) == 2;
}
DBMsgPlayerInfoRequest::DBMsgPlayerInfoRequest() {
   requestId = 0;
   isGuest = false;
}

static bool onDBMsgPlayerInfoRequestDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgPlayerInfoRequest* value = (DBMsgPlayerInfoRequest*)args;
   switch(field->m_id) {
   case 1: {
      value->requestId = reader->readInt(isSuccess);
      break;
   }
   case 2: {
      value->userName = reader->readString(isSuccess);
      break;
   }
   case 3: {
      value->password = reader->readString(isSuccess);
      break;
   }
   case 4: {
      value->isGuest = reader->readBool(isSuccess);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgPlayerInfoRequestEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgPlayerInfoRequest* value = (DBMsgPlayerInfoRequest*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeIntField(field, value->requestId);
      break;
   }
   case 2: {
      writer->writeStringField(field, value->userName);
      break;
   }
   case 3: {
      writer->writeStringField(field, value->password);
      break;
   }
   case 4: {
      writer->writeBoolField(field, value->isGuest);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgPlayerInfoRequest::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(3, writer, onDBMsgPlayerInfoRequestEncode, this);
}
bool DBMsgPlayerInfoRequest::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgPlayerInfoRequestDecode, this) == 3;
}
DBMsgPlayerInfoResponse::DBMsgPlayerInfoResponse() {
   isSuccess = false;
}

static bool onDBMsgPlayerInfoResponseDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgPlayerInfoResponse* value = (DBMsgPlayerInfoResponse*)args;
   switch(field->m_id) {
   case 1: {
      value->isSuccess = reader->readBool(isSuccess);
      break;
   }
   case 2: {
      value->userName = reader->readString(isSuccess);
      break;
   }
   case 5: {
      isSuccess = value->playerInfo.decode(proto, reader);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgPlayerInfoResponseEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgPlayerInfoResponse* value = (DBMsgPlayerInfoResponse*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeBoolField(field, value->isSuccess);
      break;
   }
   case 2: {
      writer->writeStringField(field, value->userName);
      break;
   }
   case 5: {
      writer->writeFieldHeader(field);
      value->playerInfo.encode(proto, writer);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgPlayerInfoResponse::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(4, writer, onDBMsgPlayerInfoResponseEncode, this);
}
bool DBMsgPlayerInfoResponse::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgPlayerInfoResponseDecode, this) == 4;
}
DBMsgSavePlayerInfo::DBMsgSavePlayerInfo() {
}

static bool onDBMsgSavePlayerInfoDecode(JMsgProto* proto, JMsgField* field, JMsgReader* reader, void* args) {
   bool isSuccess = false;
   DBMsgSavePlayerInfo* value = (DBMsgSavePlayerInfo*)args;
   switch(field->m_id) {
   case 1: {
      isSuccess = value->playerInfo.decode(proto, reader);
      break;
   }
   default:
      break;
   }
   return isSuccess;
}

static bool onDBMsgSavePlayerInfoEncode(JMsgProto* proto, JMsgField* field, JMsgWriter* writer, void* args) {
   DBMsgSavePlayerInfo* value = (DBMsgSavePlayerInfo*)args;
   switch(field->m_id) {
   case 1: {
      writer->writeFieldHeader(field);
      value->playerInfo.encode(proto, writer);
      break;
   }
   default:
      break;
   }
   return true;
}
void DBMsgSavePlayerInfo::encode(JMsgProto* proto, JMsgWriter* writer) {
   proto->encode(8, writer, onDBMsgSavePlayerInfoEncode, this);
}
bool DBMsgSavePlayerInfo::decode(JMsgProto* proto, JMsgReader* reader) {
   return proto->decode(reader, onDBMsgSavePlayerInfoDecode, this) == 8;
}
